Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT LAND] Process only changed metrics #236

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

shaan420
Copy link
Collaborator

PoC purposes only
Only applies to counters and gauges at the moment (not histograms)

s.reportChanges(counters, gauges)
s.cachedReporter.Flush()
// Reset the changed counters and gauges
counters = counters[:0]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to set the elements in the slice to the zero value

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what we talked about -- https://go.dev/play/p/WIRovDFJhE5

for {
select {
case c := <-s.counterChangeNotifyCh:
counters = append(counters, c)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if c is part of a subscope that's closed before you process it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, this will have the effect of flushing out any pending accumulated metrics which is desirable.

separator: sanitizer.Name(opts.Separator),
timers: make(map[string]*timer),
root: true,
counterChangeNotifyCh: make(chan *counter, 1024),
Copy link
Collaborator

@prateek prateek Oct 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm few thoughts about this channel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants